package reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author Administrator
 * @Description
 * @date 2022/5/23 11:39
 **/
public class ReflectDemo4 {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
        Class cls = Class.forName("reflect.Person");
        Object o = cls.newInstance();
        Method sayHello = cls.getMethod("sayHello");
        sayHello.invoke(o);
    }
}
